home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 1.1 KB | 45 lines | [TEXT/CWIE] |
- // Tick.h
-
- #ifndef Tick_h
- #define Tick_h
-
- #ifndef Integers_h
- #include "Integers.h"
- #endif
-
- class Tick
- {
- private:
- int32 time;
-
- public:
- Tick( uint32 t ) : time( t ) {}
-
- int32 Time() const { return time; }
-
- static Tick Now() { return TickCount(); }
-
- void operator+=( int32 d ) { time += d; }
- void operator-=( int32 d ) { time -= d; }
-
- Tick operator+( int32 d ) const { return time + d; }
- Tick operator-( int32 d ) const { return time - d; }
-
- int32 operator-( Tick t ) const { return time - t.time; }
-
- bool operator==( Tick t ) const { return time == t.time; }
- bool operator!=( Tick t ) const { return time != t.time; }
-
- // We avoid the ordinary comparisons here so that we
- // can compare times (locally) around the time when
- // TickCount overflows.
- bool operator<=( Tick t ) const { return time - t.time <= 0; }
- bool operator>=( Tick t ) const { return time - t.time >= 0; }
- bool operator<( Tick t ) const { return time - t.time < 0; }
- bool operator>( Tick t ) const { return time - t.time > 0; }
-
- void WaitFor() const;
- };
-
- #endif
-